<template>
  <div class="block">
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :page-sizes="[3, 5, 8, 10]"
      :page-size="SaleData.pageSize-0"
      :current-page="SaleData.currentPage-0"
      layout="total, sizes, prev, pager, next, jumper"
      :total="SaleData.total"
    ></el-pagination>
  </div>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
const { mapState, mapActions, mapMutations } = createNamespacedHelpers("sales");
export default {
  computed: {
    ...mapState(["SaleData"]),
  },
  methods: {
    ...mapActions(["getSalesAsync"]),
    ...mapMutations(["setCurrent", "setPageSize"]),
    //操作每页显示几条

    handleSizeChange(val) {
      this.setPageSize(val);
      this.getSalesAsync();
    },
    // 操作显示第几页
    handleCurrentChange(val) {
      this.setCurrent(val);
      this.getSalesAsync();
    },
  },
};
</script>

<style>
</style>